package com.accenture.portal.service.book.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.accenture.portal.dao.book.BookBorrowMapper;
import com.accenture.portal.dao.book.BookDetailMapper;
import com.accenture.portal.model.book.BookBorrow;
import com.accenture.portal.model.book.BookDetail;
import com.accenture.portal.service.book.BookService;

@Service
public class BookServiceImpl implements BookService
{
	@Autowired
	@Resource(name = "bookBorrowMapperImpl")
	BookBorrowMapper bbm;

	@Autowired
	@Resource(name = "bookDetailMapperImpl")
	BookDetailMapper bdm;
	
	@Override
	public List<BookDetail> listAllBooks()
	{
		return bdm.listAllBooks();
	}

	@Override
	public void saveBook(BookDetail bookDetail)
	{
		bdm.saveBook(bookDetail);
	}

	@Override
	public void updateBook(BookDetail bookDetail)
	{
		bdm.updateBook(bookDetail);
	}

	@Override
	public void removeBook(Integer bookId)
	{
		bdm.removeBook(bookId);
	}

	@Override
	public void updateBorrowState(Integer borrowId)
	{
		bdm.updateBorrowState(borrowId);
	}

	@Override
	public void updateReturnState(Integer borrowId)
	{
		bdm.updateReturnState(borrowId);
	}

	@Override
	public int totalBookCount()
	{
		return bdm.totalBookCount();
	}

	@Override
	public List<BookDetail> searchBookByPage(int start, int end)
	{
		return bdm.searchBookByPage(start,end);
	}
	
	@Override
	public void borrowBook(BookBorrow bookBorrow)
	{
		bbm.borrowBook(bookBorrow);
	}

	@Override
	public void returnBook(BookBorrow bookBorrow)
	{
		bbm.returnBook(bookBorrow);
	}

	@Override
	public List<BookBorrow> listBookByUserId(int borrowReaderid)
	{
		return bbm.listBookByUserId(borrowReaderid);
	}

	@Override
	public int getBookCountByUserId(int borrowReaderid)
	{
		return bbm.getBookCountByUserId(borrowReaderid);
	}

	@Override
	public BookDetail findBookById(int bookId)
	{
		return bdm.findBookById(bookId);
	}

	@Override
	public BookBorrow findBorrowById(int borrowId)
	{
		return bbm.findBorrowById(borrowId);
	}

	@Override
	public Integer searchBookByNameCount(String bookName)
	{
		return bdm.searchBookByNameCount(bookName);
	}

	@Override
	public List<BookDetail> searchBookByName(String bookName, Integer start,
			Integer end)
	{
		return bdm.searchBookByName(bookName,start,end);
	}

	@Override
	public Integer searchBookByAuthorCount(String bookAuthor)
	{
		return bdm.searchBookByAuthorCount(bookAuthor);
	}

	@Override
	public List<BookDetail> searchBookByAuthor(String bookAuthor,
			Integer start, Integer end)
	{
		return bdm.searchBookByAuthor(bookAuthor,start,end);
	}

	@Override
	public Integer searchBookByPressCount(String bookPress)
	{
		return bdm.searchBookByPressCount(bookPress);
	}

	@Override
	public List<BookDetail> searchBookByPress(String bookPress, Integer start,
			Integer end)
	{
		return bdm.searchBookByPress(bookPress,start,end);
	}

	@Override
	public Integer searchBookByStatusCount(Integer bookState)
	{
		return bdm.searchBookByStatusCount(bookState);
	}

	@Override
	public List<BookDetail> searchBookByStatus(Integer bookState,
			Integer start, Integer end)
	{
		return bdm.searchBookByStatus(bookState,start,end);
	}

	@Override
	public List<BookBorrow> showBorrowByBook(int borrowBookid)
	{
		return bbm.showBorrowByBook(borrowBookid);
	}

	@Override
	public List<BookDetail> searchBookByKeyword(String keyword)
	{
		return bdm.searchBookByKeyword(keyword);
	}

	@Override
	public Integer fusionSearchBookCount(String bookName, String bookAuthor,
			String bookPress, String bookState)
	{
		return bdm.fusionSearchBookCount(bookName,bookAuthor,bookPress,bookState);
	}

	@Override
	public List<BookDetail> fusionSearchBook(String bookName,
			String bookAuthor, String bookPress, String bookState,
			Integer start, Integer end)
	{
		return bdm.fusionSearchBook(bookName,bookAuthor,bookPress,bookState,start,end);
	}
	
	@Override
	public Integer findBorrowId(Integer borrowBookid, Integer borrowReaderid)
	{
		return bbm.findBorrowId(borrowBookid,borrowReaderid);
	}
}
